package com.example.nonacademic_education.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.nonacademic_education.data.request.ProjectExcelVo;
import com.example.nonacademic_education.data.request.ProjectList;
import com.example.nonacademic_education.data.response.ProjectAllDto;
import com.example.nonacademic_education.data.response.ProjectDto;
import com.example.nonacademic_education.data.response.ProjectExcelDto;
import com.example.nonacademic_education.data.response.ProjectImportDto;
import com.example.nonacademic_education.entity.Project;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author:yanghua
 * @Date:2023/4/18 19:43
 */
public interface ProjectDao extends BaseMapper<Project> {
    @Update("update project set is_del = 1 where id = #{id}")
    Boolean deleteOne(Long id);

    List<ProjectAllDto> getList(ProjectList projectList);

    Integer getNumber(ProjectList project);

    List<ProjectDto> getIdAndName(ProjectList projectList);

    @Select("select name from project where id =#{projectId}")
    String getNameById(Long projectId);

    @Select("select department_id from project where id =#{projectIdById} ;")
    Long getDepartmentIdById(Long projectIdById);

    List<ProjectExcelDto> exportStatisticsExcel(ProjectExcelVo projectExcelVo);

    Integer importProject(@Param("pid") List<ProjectImportDto> pid);

    List<ProjectAllDto> getListByInfoMiss(ProjectList projectList, List<Long> ids);

    Integer getNumberByInfoMiss(ProjectList projectList, List<Long> ids);

    List<ProjectAllDto> getListByFileMiss(ProjectList projectList, List<Long> ids);

    Integer getNumberByFileMiss(ProjectList projectList, List<Long> ids);

    List<Long> getInfoMissIds();

    List<Long> getFileMissIds();

    @Select("select year from project where id=(select tc.project_id from theclass tc where tc.id=#{classId})")
    Integer getYearByClassId(Long classId);
}
